﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Navigation;
using System.Windows.Threading;

namespace AdvancedStandingAndScholarship
{
    public partial class MainPage : Page
    {
        public MainPage()
        {
            InitializeComponent();
        }

        DispatcherTimer timer;
        // Executes when the user navigates to this page.
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            timer = new DispatcherTimer();
            timer.Interval = TimeSpan.FromSeconds(5);
            timer.Tick += new EventHandler(timer_Tick);

            if (CookieHelper.GetCookie("notification") == "y")
            {
                lblPushNotification.Text = CookieHelper.GetCookie("notificationStatus");
                lblPushNotification.Visibility = Visibility.Visible;
                CookieHelper.SetCookie("notification","n");
            }
        }

        void timer_Tick(object sender, EventArgs e)
        {
            timer.Stop();
            lblPushNotification.Visibility = Visibility.Collapsed;
        }

        private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
        {
        	// TODO: Add event handler implementation here.
            NavigationService.GoBack();
        }

        private void ScrollViewer_MouseWheel(object sender, System.Windows.Input.MouseWheelEventArgs e)
        {
        	// TODO: Add event handler implementation here.
            if (e.Delta > 0)
            {
                scrollView.ScrollToLeft();
            }
            else
            {
                scrollView.ScrollToRight();
            }
        }

        private void btnBack_Search_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
        	// TODO: Add event handler implementation here.
            gridSearch.Visibility = Visibility.Collapsed;
        }

        private void btnSearch_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
        	// TODO: Add event handler implementation here.
            NavigationService.Navigate(new Uri("/SearchStudent", UriKind.Relative));
        }

      

        private void btnAdd_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
        	// TODO: Add event handler implementation here.
            NavigationService.Navigate(new Uri("/AddPageSelectSchool", UriKind.Relative));
        }

        private void btnAccounts_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            // TODO: Add event handler implementation here.
            NavigationService.Navigate(new Uri("/AccountManagementPage", UriKind.Relative));
        }


   

  
 
    }
}
